package bitTest;


/**
 *
 * >>>逻辑移位最终的结果为正数
 * @Date 1:38 2022/11/27
 **/
public class BitType {
    public static void main(String[] args) {

    }
    public static void test() {
        int  i = -4 >>> 1;
        System.out.println(i);
        double f = 1.0;
        System.out.println(f);
        byte b;
        b = (byte) ((byte) -4 >>> 1);
        System.out.println(b);
        int c = -4 >>> 2;
        System.out.println(c);
        int pow = (int)Math.pow(2.0, 31.0);
        System.out.println(pow);
    }
    public static void test1() {
        double pow = Math.pow(2.0, 31.0);
        System.out.println(pow);
    }

    public static void test2() {
        boolean result = false;
        result &= false;
        System.out.println(result);
        int i = 5;
        i += 6;
        System.out.println(i);
        int d = 7;
        d = ++d;
        System.out.println(d);
        int j = 7;
        j = j++;
        System.out.println(j);
    }

    public static void test3() {
        int i = -4 >>> 2;
        System.out.println(i);
        int j = 8 >>> 2;
        System.out.println(j);
        int l = -5 >>> 2;
        System.out.println(l);
        System.out.println((int) (Math.pow(2.0, 30.0)) -1);
        int p = -5 / 2;
        System.out.println(p);
    }

    public static void test4() {
        int i = -5 >> 1;
        System.out.println(i);
        int p = -5 / 1;
        System.out.println(p);
        int j = 8 >> 1;
        System.out.println(j);
    }

    public static void test5() {
        int i = -5 >>> 1;
        System.out.println(i);
        int j = -2 >>> 1;
        System.out.println(j);
        int p = -1 >>> 1;
        System.out.println(p);
        int k = -3 >>> 1;
        System.out.println(k);
        int w = -5 >>> 2;
        System.out.println(w);
    }
}
